APUCORE  = snes9x/apu
INCLUDES = -I./$(APUCORE)
LDFLAGS  = -lasound
SRC      = spcplayer.cpp
SRC     += $(APUCORE)/SNES*.cpp $(APUCORE)/SPC*.cpp

all: spcplayer

spcplayer:| snesapu
	g++ -Wall -Wextra -o spcplayer $(SRC) $(INCLUDES) $(LDFLAGS)

snesapu:
#grab the snes9x source code...
#I could easily checkout just the apu subdir to save on bandwith.
#I feel that it's better to get the whole thing though.
#It is helpful to have a full copy of the emulator handy
	bash -c 'if [ ! -d ./snes9x ]; then svn checkout https://snes9x-gtk.googlecode.com/svn/trunk snes9x; fi'

install: spcplayer
	install -m 755 spcplayer ~/bin

clean:
	rm -f *.o apu/*.o spcplayer

distclean: clean
#also remove the copy of snes9x
	rm -rf snes9x

